﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using HZ.Supervise.IBLL;
using HZ.Supervise.Model;

namespace HZ.Supervise.Web.Secondphase.ReportHospital
{
    public partial class SubsidyDetailShow1 : BasePage
    {
        HZ.Supervise.IBLL.IBLL_Prescription iPrescription = HZ.Supervise.BLLFactory.IBl_Prescription();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["query"] = URLUtil.GetSuperviseQueryFromURL(Request);
                banding();

            }
        }
        //绑定未补助的医院
        private void banding()
        {
            string strSubsidyID = "";
            strSubsidyID = Request.QueryString["id"].ToString();
            if (!string.IsNullOrEmpty(strSubsidyID))
            {
                int totalrecord = 0;
                txtSubsidyID.Text = strSubsidyID;
                string strwhere = "1=1";
                //strwhere += string.Format("and SubsidyID= '{0}' ", strSubsidyID);
                HZ.Data.QueryModel qm = new HZ.Data.QueryModel();
                // strwhere += string.Format("and SubsidyID= '{0}' ", strSubsidyID);

                if (!txtPrescriptionName.Text.Trim().Equals(""))
                {
                    strwhere += "and PrescriptionName like '%" + txtPrescriptionName.Text.Trim() + "%'";
                }
                if (!txtPdoctorName.Text.Trim().Equals(""))
                {
                    strwhere += " and PdoctorName like '%" + txtPdoctorName.Text.Trim() + "%'";
                }
                if (!txtPatientName.Text.Trim().Equals(""))
                {
                    strwhere += " and PatientName like '%" + txtPatientName.Text.Trim() + "%'";
                }
                qm["Append"] = strwhere;
                qm["SubsidyID"] = strSubsidyID;
                qm["SortFields"] = "  SubsidyDetailId ASC";
                AspNetPager1.RecordCount = totalrecord;
                this.gvwDetail.DataSource = iPrescription.GetSubsidyDetailTable(qm, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalrecord);
                this.gvwDetail.DataBind();
            }

        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            banding();
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            banding();
        }
    }
}
